package compositeExpression_Factb;

import visitor.Visitor;
import compositeExpression.Cond;
import compositeExpression.Expression;
import compositeExpression.Factb;
import exceptions.IllegalContextException;

public class FactbCond extends Factb {
	
	 private Cond cond;

	    public FactbCond(Cond cond) {

	        if (cond == null) {

	            throw new NullPointerException();
	        }

	        this.cond = cond;
	    }

	    public Cond getState() {

	        return cond;
	    }// getState
	    
	    @Override
	    public String toString() {

	        StringBuilder sb = new StringBuilder();

	        sb.append(" (").append(cond).append(") ");

	        return sb.toString();
	    }

	@Override
	public void toAssess(String p) throws IllegalContextException {
		cond.toAssess(p);

	}

	@Override
    public void accept(Visitor v) {
        v.visit(this);
    }
	
	
	@Override
	public void add(Expression termb) {
		throw new IllegalStateException("operazione non valida");
	}

}
